import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  //登录页面
  {
    path: '/login',
    name: 'Login',
    component: () => import(/* webpackChunkName: "about" */ '../views/Login/login.vue')
  },
  {
    path: '/home',
    name: "Home",
    component: () => import(/* webpackChunkName: "about" */ '@/components/Home/homes'),
    children: [
      //首页Welcome页面
      {
        path: "/welcome",
        name: "Welcome",
        component: () => import(/* webpackChunkName: "about" */ '@/components/Home/Welcomes'),
      },
      //会员管理页面
      {
        path: "/member",
        name: "Member",
        component: () => import(/* webpackChunkName: "about" */ '@/components/Member/members'),
      },
      //供应商页面
      {
        path: "/supplier",
        name: "Supplier",
        component: () => import(/* webpackChunkName: "about" */ '@/components/Supplier/suppliers'),
      },
      //商品管理页面
      {
        path: "/shop",
        name: "Shop",
        component: () => import(/* webpackChunkName: "about" */ '@/components/Shop/shops'),
      },
      //员工管理页面
      {
        path: "/staff",
        name: "Staff",
        component: () => import(/* webpackChunkName: "about" */ '@/components/Staff/staffs'),
      },
      //重定向到首页Welcome中
      {
        path: '/',
        redirect: "/welcome"
      },
    ]
  },
  {
    path: '/',
    redirect: "/login",
  }
]

const router = new VueRouter({
  routes
})

export default router
